home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8503 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Sorting algorithm - In search of
  5. Date: 4 Mar 1996 11:07:04 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4hff0pINN9f4@keats.ugrad.cs.ubc.ca>
  8. References: <4h4jmq$3bh@news.cis.nctu.edu.tw> <4h6glr$ab6@utrhcs.cs.utwente.nl> <4hat5g$bdq@fohnix.metronet.com> <4hd557$ai2@garden.csc.calpoly.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4hd557$ai2@garden.csc.calpoly.edu>,
  12. Dan Stubbs <dstubbs@garden.csc.calpoly.edu> wrote:
  13.  >I agree with the comment about qsort. I many cases it is the sort technique
  14.  >of choice. However, there may be cases in which qsort is not the best. The
  15.  >question here concerns sorting an array of floats. It is probably possible
  16.  >to implement quicksort specifically for an array of floats so that it is
  17.  >faster than the (generic) qsort. If sorting the array of floats is frequent
  18.  >and time consuming it is no doubt worth comparing qsort with good 
  19.  >implementations that are hard wired for the specific problem at hand. 
  20.  
  21. Who says that qsort() necessarily uses the quicksort agorithm? 
  22.  
  23.  >Further, some implementations of qsort do not perform well for certain
  24.  
  25. You surely mean ``of quicksort''. qsort() is a standard C function that is
  26. unrelated to the quicksort algorithm.
  27.  
  28. Does the standard require that qsort() be an incarnation of Hoare's quicksort?
  29.  
  30.  >initial distributions of the data to sort. If you have such a case, then
  31.  >you need to replace qsort with another implementation of quicksort that
  32.  >is efficient for your initial distribution.
  33.  >
  34.  >For the occasional sort application, by all means, use qsort. For production
  35.  >sort problems test qsort to make sure it provides the performance you need.
  36.  
  37. You can't test qsort(), you can only test particular implementations of it. 
  38. -- 
  39.  
  40.